package bancosys.tec.security.impl.dao;

import org.hibernate.Criteria;
import org.hibernate.criterion.Restrictions;

import bancosys.tec.persist.dao.BeanNotFoundException;
import bancosys.tec.security.impl.domain.UrlCredential;

/**
 * DAO para {@link UrlCredential}.
 * 
 * @author Marco
 */
public class UrlCredentialDAO extends AbstractCredentialDAO<UrlCredential> {

    /**
     * @param url url
     * @return UrlCredential
     * @throws BeanNotFoundException BeanNotFoundException
     */
    public UrlCredential findByUrl(String url) throws BeanNotFoundException {
        Criteria criteria = this.createCriteria();
        criteria.add(Restrictions.eq("url", url));
        return this.executeSingleQuery(criteria);
    }
}
